
#pragma once

#include <ttg/libs.h>
#include "IUtility.h"
#include "UtilController.h"
#include "UtilLoader.h"

using namespace System::IO;
using namespace System::Reflection;
using namespace System::Collections::Generic;

namespace ttg_internal
{
	namespace utils
	{
		///<summary>
		/// Loads and manages uutilities.
		///<summary>
		public ref class UtilManager abstract sealed
		{
			private:
				static GlobalInfo ^_info;
				static List<UtilityPlusController ^> ^_utilities;
			public:
				static UtilManager();
			internal:
				///<summary>
				/// Returns current GlobalInfo.
				///</summary>
				static GlobalInfo ^GetInfo()
				{ return _info; }
				///<summary>
				/// Tries to register utility.
				/// If there is an error, it returns error description (nullptr otherwise) and does nothing.
				///</summary>
				static System::String ^Register(IUtility ^utility);
				///<summary>
				/// Loads utility with given name.
				/// If there is an error, it returns error description (nullptr otherwise) and does nothing.
				///</summary>
				static System::String ^Init(UtilityProps ^utility);
				///<summary>
				/// Unloads utility with given name.
				///<summary>
				static void Close(System::String ^name);
		};
	}
}